package com.seckill.orders.controller;

import com.seckill.commons.Constants;
import com.seckill.commons.ReturnObject;
import com.seckill.orders.model.Orders;
import com.seckill.orders.service.OrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

@Controller
public class OrdersController {
    @Resource
    private OrderService orderService;

    @RequestMapping("/getOrderResult")
    @ResponseBody
    public Object getOrderResult(Integer goodsId){
        Integer uid=1;
        Orders orders=orderService.getOrderResult(goodsId,uid);
        if(orders==null){
            return new ReturnObject<Orders>(Constants.ERROR,"没有获取到订单",null);
        }
        return new ReturnObject<Orders>(Constants.OK,"获取订单结果成功",orders);
    }
}
